package eva.savant.business.material.view

import eva.savant.businessobject.mt.Almacen
import eva.savant.businessobject.mt.Inventario

import javax.faces.bean.ManagedBean
import javax.faces.bean.SessionScoped
import javax.annotation.PostConstruct

@SessionScoped
@ManagedBean(name = 'IIInventario')
public class IIInventario extends Bean {

  def lsAlmacen, almacenId, total

  @PostConstruct
  public void cleanEntity() {

    lsEntity = null

    lsAlmacen= find(Almacen.class,'')
  }

  public List findLsEntity() {

    form= true

    total= get(Inventario.class,'sum(saldoValor): almacen.id=?', almacenId)

    return find(Inventario.class,'almacen.id=? order by material.id', almacenId)
  }

}
